package com.briup.cms.web.controller;

import com.briup.cms.service.Irole_privilegeService;
import com.briup.cms.utils.Message;
import com.briup.cms.utils.MessageUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@Api(description = "角色管理相关接口")
@RestController
@RequestMapping("/cms_role_privilege")
public class role_privilegeController {
    @Autowired
    private Irole_privilegeService privilegeService;
    @ApiOperation("查询所有")
    @GetMapping("findAll")
    public Message findAll(){
        List<role_privilege> list = privilegeService.findAll();
        return MessageUtil.success(list);
    }
    @ApiOperation("修改所有")
    @PostMapping("saveOrUpdate")
     public Message saveOrUpdate(role_privilege privilege){
        privilegeService.saveOrUpdate(privilege);
        return  MessageUtil.success("操作成功");
     }
    @ApiOperation("删除所有")
     @GetMapping("delete")
     public  Message delete(Long id){
        privilegeService.delete(id);
        return MessageUtil.success("删除成功");
     }
}
